﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Elderos.Dialogs;

namespace TreeBuilder
{
    public class ExceptionHandler
    {
        public bool Attempt(Action action)
        {
            try
            {
                action.Invoke();
                return true;
            }
            catch (Exception ex)
            {
                MsgBox.Show("An exception occured:" + Environment.NewLine + ex, "Exception", null, MsgBoxButtons.Ok,
                            MsgBoxImages.Stop);
                return false;
            }
        }
    }
}
